$(document).ready(function() {
  captchaPage.setFocus();
  setTimeout(function () {captchaPage.refresh();}, 30000);
});

/**
 * Define functions which be used as common function
 * @author: snipe@crebird.com
 */
CaptchaPage = function(options) {
  this.init(options);
}

$.extend(CaptchaPage.prototype, {
  options: '',
  init: function(options) {
    if (options)
      this.options = options;
  },

  setFocus: function() {
    $('#capchacontent').focus();
    $('#capchacontent').keypress(function(e) {
        if(e.keyCode==13){
        }
    });
  },

  answer: function() {
    $('#capcha-form').submit();
  },

  refresh: function() {
    setTimeout(function () {captchaPage.refresh();}, 30000);
    window.location = "/admin/capcha/answer";
  },
})

captchaPage = new CaptchaPage();